package com.HaFuManShu;

public class Node<T> {
    private T data;
    private double weight;
    private int parent;
    private int lchild;
    private int rchild;

    public Node(T data, double weight, int parent, int lchild, int rchild) {
        this.data = data;
        this.weight = weight;
        this.parent = parent;
        this.lchild = lchild;
        this.rchild = rchild;
    }

    //创建离散节点

    public Node() {
        data=null;
        weight=0.0;
        parent=0;
        lchild=-1;
        rchild=-1;
    }

    public Node(T data, double weight) {
        this.data = data;
        this.weight = weight;
        parent=0;
        lchild=-1;
        rchild=-1;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    public int getParent() {
        return parent;
    }

    public void setParent(int parent) {
        this.parent = parent;
    }

    public int getLchild() {
        return lchild;
    }

    public void setLchild(int lchild) {
        this.lchild = lchild;
    }

    public int getRchild() {
        return rchild;
    }

    public void setRchild(int rchild) {
        this.rchild = rchild;
    }
}
